//
//  CellOfSearchForTag.m
//  PetAPP
//
//  Created by apple on 16/2/25.
//  Copyright © 2016年 Yuming. All rights reserved.
//

#import "CellOfSearchForTag.h"
#import "ModelOfSearchTag.h"
#import <YYWebImage.h>

@interface CellOfSearchForTag ()

@property (nonatomic, retain) UIImageView *imageViewOfPic;

@property (nonatomic, retain) UILabel *labelOfThreadNumb;

@end

@implementation CellOfSearchForTag

- (void)dealloc {
    [_imageViewOfPic release];
    [_labelOfName release];
    [_labelOfThreadNumb release];
    [super dealloc];

}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
        
    }
    return self;
}

- (void)createSubViews {

    self.imageViewOfPic = [[UIImageView alloc] init];
    [self.contentView addSubview:_imageViewOfPic];
    [_imageViewOfPic release];
    self.imageViewOfPic.layer.cornerRadius = 25;
    self.imageViewOfPic.layer.masksToBounds = YES;
    
    
    self.labelOfName = [[UILabel alloc] init];
    [self.contentView addSubview:_labelOfName];
    [_labelOfName release];
    self.labelOfName.font = [UIFont systemFontOfSize:20];
    
    
    self.labelOfThreadNumb = [[UILabel alloc] init];
    [self.contentView addSubview:_labelOfThreadNumb];
    [_labelOfThreadNumb release];
    self.labelOfThreadNumb.font = [UIFont systemFontOfSize:17];
    self.labelOfThreadNumb.textColor = [UIColor colorWithRed:0.691 green:0.691 blue:0.691 alpha:1.0];
    
    

}

- (void)layoutSubviews {

    [super layoutSubviews];
    
    self.imageViewOfPic.frame = CGRectMake(10, 10, 50, 50);
    
    self.labelOfName.frame = CGRectMake(70, 10, 200, 25);
    
    self.labelOfThreadNumb.frame = CGRectMake(70, 40, 200, 20);
    

}

- (void)handleDataWithModel:(ModelOfSearchTag *)model {

//    self.imageViewOfPic.yy_imageURL = [NSURL URLWithString:model.cover];
    [self.imageViewOfPic yy_setImageWithURL:[NSURL URLWithString:model.cover] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation];

    
    self.labelOfName.text = model.tagname;
    
    self.labelOfThreadNumb.text = [NSString stringWithFormat:@"共有%@个贴子", model.threadNum];


}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
